import 'package:wch/generated/json/base/json_convert_content.dart';
import 'package:wch/model/patient_edit.dart';
import 'package:flutter/cupertino.dart';


PatientEditModel $PatientEditModelFromJson(Map<String, dynamic> json) {
  final PatientEditModel patientEditModel = PatientEditModel();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    patientEditModel.id = id;
  }
  final int? hospitalId = jsonConvert.convert<int>(json['hospitalId']);
  if (hospitalId != null) {
    patientEditModel.hospitalId = hospitalId;
  }
  final int? doctorId = jsonConvert.convert<int>(json['doctorId']);
  if (doctorId != null) {
    patientEditModel.doctorId = doctorId;
  }
  final int? templateId = jsonConvert.convert<int>(json['templateId']);
  if (templateId != null) {
    patientEditModel.templateId = templateId;
  }
  final String? doctorName = jsonConvert.convert<String>(json['doctorName']);
  if (doctorName != null) {
    patientEditModel.doctorName = doctorName;
  }
  final dynamic text = json['text'];
  if (text != null) {
    patientEditModel.text = text;
  }
  final List<PatientEditList>? list = (json['list'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<PatientEditList>(e) as PatientEditList)
      .toList();
  if (list != null) {
    patientEditModel.list = list;
  }
  final String? isDelete = jsonConvert.convert<String>(json['isDelete']);
  if (isDelete != null) {
    patientEditModel.isDelete = isDelete;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    patientEditModel.createTime = createTime;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    patientEditModel.updateTime = updateTime;
  }
  return patientEditModel;
}

Map<String, dynamic> $PatientEditModelToJson(PatientEditModel entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['hospitalId'] = entity.hospitalId;
  data['doctorId'] = entity.doctorId;
  data['templateId'] = entity.templateId;
  data['doctorName'] = entity.doctorName;
  data['text'] = entity.text;
  data['list'] = entity.list?.map((v) => v.toJson()).toList();
  data['isDelete'] = entity.isDelete;
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  return data;
}

extension PatientEditModelExtension on PatientEditModel {
  PatientEditModel copyWith({
    int? id,
    int? hospitalId,
    int? doctorId,
    int? templateId,
    String? doctorName,
    dynamic text,
    List<PatientEditList>? list,
    String? isDelete,
    String? createTime,
    String? updateTime,
  }) {
    return PatientEditModel()
      ..id = id ?? this.id
      ..hospitalId = hospitalId ?? this.hospitalId
      ..doctorId = doctorId ?? this.doctorId
      ..templateId = templateId ?? this.templateId
      ..doctorName = doctorName ?? this.doctorName
      ..text = text ?? this.text
      ..list = list ?? this.list
      ..isDelete = isDelete ?? this.isDelete
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime;
  }
}

PatientEditList $PatientEditListFromJson(Map<String, dynamic> json) {
  final PatientEditList patientEditList = PatientEditList();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    patientEditList.id = id;
  }
  final int? sickPersonId = jsonConvert.convert<int>(json['sickPersonId']);
  if (sickPersonId != null) {
    patientEditList.sickPersonId = sickPersonId;
  }
  final int? templateItemId = jsonConvert.convert<int>(json['templateItemId']);
  if (templateItemId != null) {
    patientEditList.templateItemId = templateItemId;
  }
  final int? doctorId = jsonConvert.convert<int>(json['doctorId']);
  if (doctorId != null) {
    patientEditList.doctorId = doctorId;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    patientEditList.name = name;
  }
  final String? text = jsonConvert.convert<String>(json['text']);
  if (text != null) {
    patientEditList.text = text;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    patientEditList.type = type;
  }
  final String? label = jsonConvert.convert<String>(json['label']);
  if (label != null) {
    patientEditList.label = label;
  }
  final String? status = jsonConvert.convert<String>(json['status']);
  if (status != null) {
    patientEditList.status = status;
  }
  final int? sort = jsonConvert.convert<int>(json['sort']);
  if (sort != null) {
    patientEditList.sort = sort;
  }
  final TextEditingController? controller = jsonConvert.convert<
      TextEditingController>(json['controller']);
  if (controller != null) {
    patientEditList.controller = controller;
  }
  return patientEditList;
}

Map<String, dynamic> $PatientEditListToJson(PatientEditList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['sickPersonId'] = entity.sickPersonId;
  data['templateItemId'] = entity.templateItemId;
  data['doctorId'] = entity.doctorId;
  data['name'] = entity.name;
  data['text'] = entity.text;
  data['type'] = entity.type;
  data['label'] = entity.label;
  data['status'] = entity.status;
  data['sort'] = entity.sort;
  return data;
}

extension PatientEditListExtension on PatientEditList {
  PatientEditList copyWith({
    int? id,
    int? sickPersonId,
    int? templateItemId,
    int? doctorId,
    String? name,
    String? text,
    int? type,
    String? label,
    String? status,
    int? sort,
    TextEditingController? controller,
  }) {
    return PatientEditList()
      ..id = id ?? this.id
      ..sickPersonId = sickPersonId ?? this.sickPersonId
      ..templateItemId = templateItemId ?? this.templateItemId
      ..doctorId = doctorId ?? this.doctorId
      ..name = name ?? this.name
      ..text = text ?? this.text
      ..type = type ?? this.type
      ..label = label ?? this.label
      ..status = status ?? this.status
      ..sort = sort ?? this.sort
      ..controller = controller ?? this.controller;
  }
}